package cate.game.play.skill.passive.exp;

import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.ActionCtx;
import cate.game.play.skill.passive.PassiveHandler;

import java.util.List;

/**
 *第4、8、12回合无法进行普通攻击，但回合结束后自身恢复10%最大生命值,并为敌方全体造成攻击力80%的伤害
 */
public class 混世魔王PH extends PassiveHandler {

	private List<Integer> 回合;

	private int 缴械buff;

	private double 自身恢复;

	private double 伤害系数;

	//回合=4#8#12&缴械buff=？？&自身恢复=？？&伤害系数=？？
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		回合 = args.getIntList("回合");
		缴械buff = args.getInt("缴械buff");
		自身恢复 = args.getWDouble("自身恢复", 0d);
		伤害系数 = args.getWDouble("伤害系数", 0d);
	}

	@Override
	public void onRoundBegin(ActionCtx action) {
		if (!回合.contains(action.getRound().index)) {
			return;
		}
		skill.owner.buff.tryAddByTid(action, 缴械buff);
	}

	@Override
	public void onRoundEnd(ActionCtx action) {
		if (!回合.contains(action.getRound().index)) {
			return;
		}
		if (skill.owner.isDead()) {
			return;
		}
		skill.owner.attr.passiveHeal(action, skill.owner.attr.total().hpTotal() * 自身恢复);
		double v = skill.owner.attr.attTotal() * 伤害系数;
		for (Fighter fighter : action.getTeamVs().getEnemyTeam(skill.owner.getTeam()).getFightersAlive()) {
			fighter.attr.passiveHurt(action, skill.owner, v);
		}
	}

}
